package com.cm.caseManagement.service.impl;

import com.cm.caseManagement.dao.CmEntrustRecordMapper;
import com.cm.caseManagement.pojo.entity.CmEntrustRecord;
import com.cm.caseManagement.service.ICmEntrustRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 委托记录Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmEntrustRecordServiceImpl implements ICmEntrustRecordService
{
    @Autowired
    private CmEntrustRecordMapper cmEntrustRecordMapper;

    /**
     * 查询委托记录
     *
     * @param id 委托记录主键
     * @return 委托记录
     */
    @Override
    public CmEntrustRecord selectCmEntrustRecordById(Long id)
    {
        return cmEntrustRecordMapper.selectCmEntrustRecordById(id);
    }

    /**
     * 查询委托记录列表
     *
     * @param cmEntrustRecord 委托记录
     * @return 委托记录
     */
    @Override
    public List<CmEntrustRecord> selectCmEntrustRecordList(CmEntrustRecord cmEntrustRecord)
    {
        return cmEntrustRecordMapper.selectCmEntrustRecordList(cmEntrustRecord);
    }

    /**
     * 新增委托记录
     *
     * @param cmEntrustRecord 委托记录
     * @return 结果
     */
    @Override
    public int insertCmEntrustRecord(CmEntrustRecord cmEntrustRecord)
    {
        cmEntrustRecord.setCreateTime(DateUtils.getNowDate());
        return cmEntrustRecordMapper.insertCmEntrustRecord(cmEntrustRecord);
    }

    /**
     * 修改委托记录
     *
     * @param cmEntrustRecord 委托记录
     * @return 结果
     */
    @Override
    public int updateCmEntrustRecord(CmEntrustRecord cmEntrustRecord)
    {
        cmEntrustRecord.setUpdateTime(DateUtils.getNowDate());
        return cmEntrustRecordMapper.updateCmEntrustRecord(cmEntrustRecord);
    }

    /**
     * 批量删除委托记录
     *
     * @param ids 需要删除的委托记录主键
     * @return 结果
     */
    @Override
    public int deleteCmEntrustRecordByIds(Long[] ids)
    {
        return cmEntrustRecordMapper.deleteCmEntrustRecordByIds(ids);
    }

    /**
     * 删除委托记录信息
     *
     * @param id 委托记录主键
     * @return 结果
     */
    @Override
    public int deleteCmEntrustRecordById(Long id)
    {
        return cmEntrustRecordMapper.deleteCmEntrustRecordById(id);
    }
}
